package com.sinven.mapper;

import com.sinven.pojo.Article;
import com.sinven.vo.ArticleCondition;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ArticleMapper {
    /**
     * 按分类统计文章数量
     * @param cid 文章分类ID
     * @return 文章数量
     */
    long countArticle(int cid);

    /**
     * 添加新文章
     * @param article 文章信息
     * @return <i>1</i>添加成功 <i>0</i>添加失败
     */
    int addArticle(Article article);

    int updateArticle(Article article);

    int deleteArticle(long articleId);

    List<Article> queryArticles(@Param("cid")int cid,
                                @Param("startIndex")long startIndex,
                                @Param("pageSize") int pageSize);

    Article queryArticle(long articleId);

    List<Article> queryByCondition(ArticleCondition articleVo);

    List<Article> queryIndexActivity();
}
